<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/style.css" />
<title>CI 后台管理系统 管理员修改</title>
</head>
<body>
<article class="cl pd-20">
	<form action="" method="post" class="form form-horizontal" id="form">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>账号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="<?=$vo['account']?>" placeholder="4到12个字符" id="account" name="account">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>昵称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  value="<?=$vo['nickname']?>" placeholder="" id="nickname" name="nickname">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">分配角色：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                <select class="select" size="1" name="role_id">
                    <option value="">暂不分配</option>
                    <? foreach ($roles as $k=>$v):?>
                        <option value="<?=$v['id']?>" <? if($vo['role_id'] == $v['id']):?>selected <? endif;?>><?=$v['name']?></option>
                    <? endforeach;?>
                </select>
                </span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  placeholder="(不修改则不填)" id="password" name="password">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">* </span>确认密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" autocomplete="off"  placeholder="(不修改则不填)" id="password2" name="password2">
            </div>
        </div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" name="id" value="<?=$vo['id']?>">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>


<script type="text/javascript" src="/public/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/public/lib/layer/layer.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui.admin/js/H-ui.admin.page.js"></script>

<script type="text/javascript" src="/public/lib/validate/jquery.validate.min.js"></script>

<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").validate({
            rules:{
                account:{
                    required:true,
                    minlength:4,
                    maxlength:12
                },
                nickname:{
                    required:true
                },
                password:{
                    minlength:4,
                    maxlength:16
                },
                password2:{
                    equalTo: "#password"
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $.ajax({
                    dataType:'json',
                    type: 'post',
                    url: '/Systems/administrator_edit_do',
                    data: $('#form').serialize(),
                    success: function(data){
                        if(1 == data){
                            layer.msg('修改成功!', {
                                icon: 1,
                                time: 2000 //2秒关闭（如果不配置，默认是3秒）
                            }, function(){
                                parent.layer.closeAll();
                            });
                        }else if(999 == data){
                            layer.msg('暂无权限!',{icon:4,time:1000});
                        }else{
                            layer.msg('修改失败!');
                        }
                    }
                });
            }
        });
    });
</script>
</body>
</html>